
	






function create_team_view(){
		var items;
		var htmlstr="";
		$.getJSON("/index.php/task/get_team_task/", 
			function(dataGet) { 
//			console.log(dataGet);
				if(dataGet.data){
					items=dataGet.data;
						$.each(items,function(idx,item){ 
							htmlstr+=new_task(item);
						});
					$("#team_view>#905").append(htmlstr);
					

					
				}
			}		
		);
}







//创建参与的团队列表
	function create_team_list(){
		var items;
		var htmlstr="";
		$.getJSON("/index.php/team/get_my_team_list/", 
			function(dataGet) { 
//			console.log(dataGet);
				if(dataGet.data){
					// items=dataGet.data;
						// $.each(items,function(idx,item){ //生成所有任务，先挂装到不分类任务下
							// console.log(item);
							// htmlstr+='<div id="day-'+item.day+'" class="task day" data-day="'+item.day+'"><a class="expend_day expend_fold" href="###" title="展开"><i class="fa fa-folder-o"></i></a><span class="task_title task_for_drag " title="">'+item.teamname+'</span><span class="task_count">'+item.task_count+'</span><span class=""><A href="/team/'+item.id+'" target=_BLANK>&gt;&gt;</A></span></div>';

						// });
					// $("#team_view>#905").append(htmlstr);
//					console.log(dataGet.data);
	//				console.log(v_teamlist);
//					v_teamlist.items = dataGet.data;
					
					v_teamlist = new Vue({
					  el: '#teamlist',
					  data: {
						items: dataGet.data,
					  }
					});
				}
			}		
		);
	}



function create_team_member(){
		var items;
		var htmlstr="";
		$.getJSON("/index.php/team/get_team_member/"+teamid, 
			function(dataGet) { 
//			console.log(dataGet);
				if(dataGet.data){

					var example1 = new Vue({
					  el: '#team_member_list',
					  data: {
						items: dataGet.data,
					  }
					});
                    
 //给每位用户创建的任务增加头像图片，通过动态创建css来实现                   
items2=dataGet.data;
    //                console.log(items2);
$.each(items2,function(idx,item){ //
 //   console.log(idx);
    console.log(item.id);
//$("head").append("<style>div.task[data-author='"+item.id+"']>a.btn_for_toolbar::before{content:url("+item.ProfilePhoto+");}</style>");
    
$("head").append("<style>div.task[data-author='"+item.id+"']>.profile_photo{background-image:url("+item.ProfilePhoto+");}</style>");
});
                    
                }
        }		
		);
    
    			
 //   $("div.task").css("content",'url(/_assets/icons/hands5.svg)');  
//    $("head").append("<style>div.task[data-author='2']>a.btn_for_toolbar::before{ content: url(/_assets/icons/hands5.svg); }</style>");
    
    
}


function team_add(){
	console.log('teamadd');
 	var new_team_title=$("#input_team_add").val();
	if (new_team_title==''){
		layer.msg('空内容，无视！',{time: 2000});
		return;
	}
	$.post("/index.php/team/insert",
	  {
		title:new_team_title
	  },
	  function(dataGet,status){
		if(dataGet){
			
				$("#input_team_add").val('');
				v_teamlist.items.push({ teamname: new_team_title,id:dataGet.data.newid })
				

				
				
				create_team_list();
					
			if(dataGet.status){
			}else{
				layer.msg(dataGet.message,{time: 2000});
			}
		}
	  },"json");
 }
 





$(document).ready(function() {

	

		 
});	//end of $(document).ready事件